package fr.udata.client.activity;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;

import fr.udata.client.ClientFactory;
import fr.udata.client.place.SigninPlace;
import fr.udata.client.place.SignupPlace;

public class AppActivityMapper implements ActivityMapper {
	private ClientFactory clientFactory;

	public AppActivityMapper(ClientFactory clientFactory) {
		super();
		this.clientFactory = clientFactory;
	}

	@Override
	public Activity getActivity(Place place) {
		if (place instanceof SigninPlace) {
			return new SigninActivity((SigninPlace) place, clientFactory);
		}
		if (place instanceof SignupPlace) {
			return new SignupActivity((SignupPlace) place, clientFactory);
		}

		return null;
	}
}